﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Strategy
{
    /// <summary>
    /// 封裝角色
    /// </summary>
    public class Context
    {
        /// <summary>
        /// 抽象策略
        /// </summary>
        private IStrategy strategy = null;

        /// <summary>
        /// 構造函數設置具體策略
        /// </summary>
        /// <param name="_strategy"></param>
        public Context(IStrategy _strategy)
        {
            this.strategy = _strategy;
        }

        /// <summary>
        /// 封裝後的策略方法
        /// </summary>
        /// <returns></returns>
        public string doAnything()
        {
            return  this.strategy.doSomething();
        }
    }
}
